function StateMachine()
{
    this.interpreter = null;
    this.handler = null;
    this.ruleFile = null;

    this.current = null;
};
StateMachine.CreateDefault = function() {
    var machine = new StateMachine();
    machine.interpreter = new JsonRuleInterpreter();

    return machine;
};
StateMachine.prototype.WithHandler = function (handler) {
    this.handler = handler;
    return this;
};
StateMachine.prototype.WithRuleFile = function(ruleFile) {
    this.interpreter.Load(ruleFile);
    return this;
};
StateMachine.prototype.WithInterpreter = function (interpreter) {
    this.interpreter = interpreter;
    this.interpreter.onAction.Add(, this);
    return this;
};
StateMachine.prototype.Initialize = function () {
    this.interpreter.Initialize();
    return this;
};
StateMachine.prototype.process = function (event, args) {
    if(this.interpreter.Process(event, args))
        this.current = this.interpreter.currentState;
};
StateMachine.prototype.onAction = function (params) {
    if (this.handler)
        this.handler.call(this, params["actionMessage"]);
};